/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package uttt.edu.mx.datos;

import java.sql.Connection;
import java.sql.Date;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import uttt.edu.mx.entidades.EntInsertarPersona;
import uttt.edu.mx.conexion.Conexion;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Jesus Santiago
 */
public class CtrlPersona extends Conexion {

    private PreparedStatement st = null;
    private Connection conn;

    public boolean insertar(Object _Obj) {
        EntInsertarPersona persona = (EntInsertarPersona) _Obj;
        try {
            Conexion datos = new Conexion();
            Connection conn = datos.getConexion();
            if (conn != null) {
                String query = "INSERT INTO persona ( nombre, apellidos, edad, direccion, telefono, sexo, curp, status, observaciones, fecha_Nacimiento, tutor,nivel) "
                        + " VALUES ( '" + persona.getNombre()
                        + "' , '" + persona.getApellidos()
                        + "' , '" + persona.getEdad()
                        + "' , '" + persona.getDireccion()
                        + "' , '" + persona.getTelefono()
                        + "' , '" + persona.getSexo()
                        + "' , '" + persona.getCurp()
                        + "' , '" + persona.getStatus()
                        + "' , '" + persona.getObservaciones()
                        + "' , '" + persona.getFechaNacimiento()
                        + "' , '" + persona.getTutor()
                        + "' , '" + persona.getNivel() + "');";
                st = conn.prepareStatement(query);
                int executeUpdate = st.executeUpdate();
                return true;
            } else {
                return false;
            }
        } catch (Exception ex) {
            System.out.println(ex.getMessage());
            return false;
        }

    }

    public boolean eliminar(Object _Obj) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    public List<Object> consultar(Object _Obj) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    public boolean modificar(Object _Obj) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }
}
